<template>
  <fieldset>
    <legend>登录</legend>
    <button @click="handleClick">点击登录</button>
  </fieldset>
</template>
<script>
import axios from "axios";
export default {
  methods: {
    handleClick() {
      // 发送post请求
      // 1.url请求地址
      // 2.要向后台传递的参数
      // 3.一些选项
      axios
        .post(
          "http://chst.vip:1902/users/login",
          {
            username: "lbw",
            password: "555",
          },
          {
            headers: {
              qf: "1234321",
            },
          }
        )
        .then((res) => {
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
